package view;

import java.awt.Color;
import java.awt.Component;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import javax.swing.BorderFactory;
import javax.swing.JCheckBox;
import javax.swing.JTree;
import javax.swing.UIManager;
import javax.swing.plaf.ButtonUI;
import javax.swing.tree.TreeCellRenderer;

//import model.FilesystemFolderModel;
//import model.FolderBean;

public class CheckboxCellRenderer_1 implements TreeCellRenderer {

    private Color selectionBorderColor;
    private Color selectionForeground;
    private Color selectionBackground;
    private Color textForeground;
    private Color textBackground;
    private JCheckBox checkbox = new JCheckBox();

    public CheckboxCellRenderer_1() {
        // setFocusPainted(true);
        // setFocusable(true);
        selectionBorderColor = UIManager.getColor("Tree.selectionBorderColor");
        selectionForeground = UIManager.getColor("Tree.selectionForeground");
        selectionBackground = UIManager.getColor("Tree.selectionBackground");
        textForeground = UIManager.getColor("Tree.textForeground");
        textBackground = UIManager.getColor("Tree.textBackground");
    }

    public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded,
            boolean leaf, int row, boolean hasFocus) {
     /*  FolderBean folder = (FolderBean) value;
        checkbox.setText(folder.toString());
        checkbox.setSelected(folder.isChecked());
        if (folder == FilesystemFolderModel.ROOT) {
            checkbox.setIcon(UIManager.getIcon("FileView.hardDriveIcon"));
        } else {
            checkbox.setIcon(null);
        }
*/
        if (sel) {
            checkbox.setForeground(selectionForeground);
            checkbox.setBackground(selectionBackground);
            // setBorder(BorderFactory.createLineBorder(selectionBorderColor));
        } else {
            checkbox.setForeground(textForeground);
            checkbox.setBackground(textBackground);
        }
        // FileView.computerIcon
        // FileView.hardDriveIcon

        checkbox.setEnabled(tree.isEnabled());

        return checkbox;
    }

}
